package com.hzhc.controller.sysmanage;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hzhc.common.BaseController;
import com.hzhc.entity.SysExceptionLog;
import com.hzhc.enumBean.ResultUtilCodeEnum;
import com.hzhc.service.SysExceptionLogService;
import com.hzhc.utils.ResultUtil;
import com.hzhc.vo.SysExceptionLogVo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 异常日志 前端控制器
 * </p>
 *
 * @author shizj
 * @since 2021-11-02
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/system/exceptionLog")
public class SysExceptionLogController extends BaseController {

    public final SysExceptionLogService exceptionLogService;



    /**
     * 系统日志分页列表
     * @param sysExceptionLogVo
     * @return
     */
    @RequestMapping("/getExceptionLogList")
    public ResultUtil<List<SysExceptionLog>> getExceptionLogList(@RequestBody SysExceptionLogVo sysExceptionLogVo) {
        Page<SysExceptionLog> page = new Page<>(sysExceptionLogVo.getPageIndex(),sysExceptionLogVo.getPageSize());
        List<SysExceptionLog> sysLogList = exceptionLogService.getExceptionLogList(page, sysExceptionLogVo);
        return ResultUtil.build(sysLogList,page.getTotal(),page.getPages(), ResultUtilCodeEnum.SUCCESS);
    }

}
